
function saveSchedule() {
  const data = {
    doctorId: detailDoctor.value.doctorId,
    date: detailSelectedDate.value.format('YYYY-MM-DD'),
    am: {
      isAvailable: editForm.am.isAvailable,
      // 修改: 将本地时间转换为UTC时间
      startTime: moment(detailSelectedDate.value.format('YYYY-MM-DD') + ' ' + editForm.am.startTime, 'YYYY-MM-DD HH:mm').utc().format('YYYY-MM-DDTHH:mm:ss[Z]'),
      endTime: moment(detailSelectedDate.value.format('YYYY-MM-DD') + ' ' + editForm.am.endTime, 'YYYY-MM-DD HH:mm').utc().format('YYYY-MM-DDTHH:mm:ss[Z]'),
      slotCount: editForm.am.slotCount
    },
    pm: {
      isAvailable: editForm.pm.isAvailable,
      // 修改: 将本地时间转换为UTC时间
      startTime: moment(detailSelectedDate.value.format('YYYY-MM-DD') + ' ' + editForm.pm.startTime, 'YYYY-MM-DD HH:mm').utc().format('YYYY-MM-DDTHH:mm:ss[Z]'),
      endTime: moment(detailSelectedDate.value.format('YYYY-MM-DD') + ' ' + editForm.pm.endTime, 'YYYY-MM-DD HH:mm').utc().format('YYYY-MM-DDTHH:mm:ss[Z]'),
      slotCount: editForm.pm.slotCount
    }
  }
  axioswmedical.post('/DoctorSchedule/SetDoctorDaySchedule', data).then(res => {
    if (res.data.code === 200) {
      ElMessage.success('排班设置成功')
      editMode.value = false
      detailDialogVisible.value = false
      fetchData() // 刷新主表
    } else {
      ElMessage.error(res.data.msg || '排班设置失败')
    }
  })
}
